{% extends "base.html" %}
{% block content %}

<script type='text/javascript'>
$(function () {
  $('[data-toggle="tooltip"]').tooltip()
})
</script>

<div class="row">
    <div class="col-md-6" style="border-right: 1px dashed #ddd;">
        <h2 style="text-align: center;">Analysis 1</h2>

        {% include "compare/_info.html" with record=left %}
    </div>
    <div class="col-md-6">
        <h2 style="text-align: center;">Analysis 2</h2>
        {% include "compare/_info.html" with record=right %}
        <div class="col-md-8">
        </div>
    </div>
</div>
<div class="mt-3">
    <h4>Execution Graph</h4>

    <p>This graph gives you an abstracted overview of the execution of the analyzer file. More specifically it represents the percentage of occurrences of behavioral events classified by category: the bigger the colored block, the higher is the count of events for the respective category performed by the analyzed malware</p>
    <p>Comparing two graphs from different analyses can give you help estimate how much the behavior of the two files differ.</p>
    <p>Following are the colored categories:</p>

    <p style="text-align: center;">
        <span class="badge registry" style="color:black;">registry</span>
        <span class="badge filesystem" style="color:black;">filesystem</span>
        <span class="badge system" style="color:black;">system</span>
        <span class="badge network" style="color:black;">network</span>
        <span class="badge process" style="color:black;">process</span>
        <span class="badge services" style="color:black;">services</span>
        <span class="badge synchronization" style="color:black;">synchronization</span>
        <span class="badge windows" style="color:black;">windows</span>
    </p>
</div>
<div class="row">
    <div class="col-md-6" style="border-right: 1px dashed #ddd;">
        <div class="m-auto" style="height: 300px;border: 2px solid #666; width: 30%;">
            {% for cat, count in left_counts.items %}
                <div style="height: {{count}}%" class="{{cat}}" data-toggle="tooltip" data-placement="top" title="{{count}}% {{cat}}"></div>
            {% endfor %}
        </div>
    </div>
    <div class="col-md-6">
        <div class="m-auto" style="height: 300px;border: 2px solid #666; width: 30%;">
            {% for cat, count in right_counts.items %}
                <div style="height: {{count}}%" class="{{cat}}" data-toggle="tooltip" data-placement="top" title="{{count}}% {{cat}}"></div>
            {% endfor %}
        </div>
    </div>
</div>
<hr/>
<div class="row">
    <h2 style="text-align: left;"> Summary Similarities</h2>
        <ul class="nav nav-pills" style="margin-bottom: 0;">
            <li class="nav-item active"><a class="nav-link" href=#summary_compare_files data-toggle="tab">Accessed Files</a></li>
            <li class="nav-item"><a class="nav-link" href=#summary_compare_read_files data-toggle="tab">Read Files</a></li>
            <li class="nav-item"><a class="nav-link" href=#summary_compare_write_files data-toggle="tab">Modified Files</a></li>
            <li class="nav-item"><a class="nav-link" href=#summary_compare_delete_files data-toggle="tab">Deleted Files</a></li>
            <li class="nav-item"><a class="nav-link" href=#summary_compare_keys data-toggle="tab">Accessed Registry Keys</a></li>
            <li class="nav-item"><a class="nav-link" href=#summary_compare_read_keys data-toggle="tab">Read Registry Keys</a></li>
            <li class="nav-item"><a class="nav-link" href=#summary_compare_write_keys data-toggle="tab">Modified Registry Keys</a></li>
            <li class="nav-item"><a class="nav-link" href=#summary_compare_delete_keys data-toggle="tab">Deleted Registry Keys</a></li>
            <li class="nav-item"><a class="nav-link" href=#summary_compare_resolved_apis data-toggle="tab">Resolved APIs</a></li>
            <li class="nav-item"><a class="nav-link" href=#summary_compare_executed_commands data-toggle="tab">Executed Commands</a></li>
            <li class="nav-item"><a class="nav-link" href=#summary_compare_mutexes data-toggle="tab">Mutexes</a></li>
            <li class="nav-item"><a class="nav-link" href=#summary_compare_created_services data-toggle="tab">Created Services</a></li>
            <li class="nav-item"><a class="nav-link" href=#summary_compare_started_services data-toggle="tab">Started Services</a></li>
        </ul>
        <div class="tab-content">
            <div class="tab-pane fade show active" id="summary_compare_files">
                <div class="card card-body">
                {% if summary.files %}
                    {% for file in summary.files %}
                        {{file}}<br />
                    {% endfor %}
                {% else %}
                No similarly accessed files.
                {% endif %}
                </div>
            </div>
            <div class="tab-pane fade" id="summary_compare_read_files">
                <div class="card card-body">
                {% if summary.read_files %}
                    {% for file in summary.read_files %}
                        {{file}}<br />
                    {% endfor %}
                {% else %}
                No similarly read files.
                {% endif %}
                </div>
            </div>
            <div class="tab-pane fade" id="summary_compare_write_files">
                <div class="card card-body">
                {% if summary.write_files %}
                    {% for file in summary.write_files %}
                        {{file}}<br />
                    {% endfor %}
                {% else %}
                No similarly written files.
                {% endif %}
                </div>
            </div>
            <div class="tab-pane fade" id="summary_compare_delete_files">
                <div class="card card-body">
                {% if summary.delete_files %}
                    {% for file in delete_files %}
                        {{file}}<br />
                    {% endfor %}
                {% else %}
                No similarly deleted files.
                {% endif %}
                </div>
            </div>
            <div class="tab-pane fade" id="summary_compare_keys">
                <div class="card card-body">
                {% if summary.keys %}
                    {% for key in summary.keys %}
                        {{key}}<br />
                    {% endfor %}
                {% else %}
                No similarly accessed registry keys.
                {% endif %}
                </div>
            </div>
            <div class="tab-pane fade" id="summary_compare_read_keys">
                <div class="card card-body">
                {% if summary.read_keys %}
                    {% for key in summary.read_keys %}
                        {{key}}<br />
                    {% endfor %}
                {% else %}
                No similarly read registry keys.
                {% endif %}
                </div>
            </div>
            <div class="tab-pane fade" id="summary_compare_write_keys">
                <div class="card card-body">
                {% if summary.write_keys %}
                    {% for key in summary.write_keys %}
                        {{key}}<br />
                    {% endfor %}
                {% else %}
                No similarly written registry keys.
                {% endif %}
                </div>
            </div>
            <div class="tab-pane fade" id="summary_compare_delete_keys">
                <div class="card card-body">
                {% if summary.delete_keys %}
                    {% for key in summary.delete_keys %}
                        {{key}}<br />
                    {% endfor %}
                {% else %}
                No similarly deleted registry keys.
                {% endif %}
                </div>
            </div>
            <div class="tab-pane fade" id="summary_compare_resolved_apis">
                <div class="card card-body">
                {% if summary.resolved_apis %}
                    {% for api in summary.resolved_apis %}
                        {{api}}<br />
                    {% endfor %}
                {% else %}
                No similarly resolved API imports.
                {% endif %}
                </div>
            </div>
            <div class="tab-pane fade" id="summary_compare_executed_commands">
                <div class="card card-body">
                {% if summary.executed_commands %}
                    {% for cmd in summary.executed_commands %}
                        {{cmd}}<br />
                    {% endfor %}
                {% else %}
                No similarly executed commands.
                {% endif %}
                </div>
            </div>
            <div class="tab-pane fade" id="summary_compare_mutexes">
                <div class="card card-body">
                {% if summary.mutexes %}
                    {% for mutex in summary.mutexes %}
                        {{mutex}}<br />
                    {% endfor %}
                {% else %}
                No similarly created mutexes.
                {% endif %}
                </div>
            </div>
            <div class="tab-pane fade" id="summary_compare_created_services">
                <div class="card card-body">
                {% if summary.created_services %}
                    {% for service in summary.created_services %}
                        {{service}}<br />
                    {% endfor %}
                {% else %}
                No similarly created services
                {% endif %}
                </div>
            </div>
            <div class="tab-pane fade" id="summary_compare_started_services">
                <div class="card card-body">
                {% if summary.started_services %}
                    {% for service in summary.started_services %}
                        {{service}}<br />
                    {% endfor %}
                {% else %}
                No simiarly started services.
                {% endif %}
                </div>
            </div>
        </div>
</div>
{% endblock %}
